<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><?php 
switch ($lt) {
    case 'new':
        echo '生词';
        break;
    case 'done':
        echo '熟词';
        break;
    default:
        echo '最近查询';
}
?></title>
</head>
<body>
<?php
$this->render('header');
$links = array(
    array('new','生词','./',true),
    array('done','熟词','?list=done',true),
    array('recently','最近查询','?list=recently',false),
);
foreach ($links as $link) {
    if ($link[3]==true && !$login) {
        continue;
    }
    if ($lt==$link[0]) {
        echo $link[1],'&nbsp;';
    } else {
        echo '<a href="',$link[2],'">',$link[1],'</a>&nbsp;';
    }
}
if ($login || $lt=='recently') {
?>
<br /><ul>
<?php
foreach ($words as $w) {
    echo '<li><a href="?w=',$w,'">',$w,'</a></li>';
}
?>
</ul>
<?php 
$url=null;
if ($lt=='new') {
    $basic_url='./';
    $url='./?';
} elseif ($lt=='done') {
    $basic_url='./?list=done';
    $url='./?list=done&amp;';
}
if ($url) {
    if ($page>2) {
        echo '<a href="',$url,'page=',($page-1),'">上页</a>';
        echo '&nbsp;';
    } elseif ($page>1) {
        echo '<a href="',$basic_url,'">上页</a>';
        echo '&nbsp;';
    }

    if ($page*$num<$count) {
        echo '<a href="',$url,'page=',($page+1),'">下页</a>';
    }
}
}
$this->render('footer');
?>
</body>
</html>
